<template>
<div class="feed">
  <el-page-header @back="goBack" content="个人主页"/>
  <br><br>
  <h1 align=center><font style="font-family: 华文行楷">用户反馈</font></h1>
  <form method="post" >
      请输入您对网站的建议<br><br>
    <div class="feedcontent">
      <el-input
        type="textarea"
        :rows="6"
        placeholder="请输入您的建议"
        v-model="suggest">
    </el-input>
    </div>
    <p>
      <br>
      <el-button @click="tj()">提交</el-button>
      <el-button @click="clean()">清除</el-button>
    </p>
  </form>
</div>
</template>

<script>
import {addFeedBack} from '../../api/index'
export default {
  data() {
    return {
      suggest:''
    }
  },
  methods:{
  goBack(){
    this.$router.push({path:'/Mine'})
  },
    tj(){
      addFeedBack({id:window.localStorage.getItem('id'),contents:this.suggest}).then(res => {
      console.log(res.data.code)
        if(res.data.code===100){
          this.$message({
            type:'success',
            message:'反馈成功'
          })
          this.suggest=''
        }else{
          this.$message.error({message:'反馈失败'})
        }
    })
    },
    clean(){
    this.suggest='',
        this.$message({
          type:'warning',
          message:'已清空'
        })
    }
  }
}
</script>

<style scoped>
.feed{
  width: 100%;
  height: 836px;
  background: url("../../static/1.png") no-repeat;
  background-size: cover;
  overflow: hidden;
}

.feedcontent{
  margin-left: 50px;
  margin-right: 50px;
}
</style>
